//
//  BusinessCell.m
//  EducationAdminClient
//
//  Created by kwsdzjx on 15/12/2.
//  Copyright © 2015年 周佳兴. All rights reserved.
//

#import "BusinessCell.h"
#import "Masonry.h"
#define LABELLEFT 30/2
@implementation BusinessCell
-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
    if (self) {
        UIView *view = [self createUI];
        [self.contentView addSubview:view];
        [view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left);
            make.right.equalTo(self.contentView.mas_right);
            make.height.equalTo(self.contentView.mas_height);
            make.bottom.equalTo(self.contentView.mas_bottom);
        }];
    }
    return self;
}

-(UIView *)createUI{
    UIView *baseView = [[UIView alloc]init];
    baseView.backgroundColor =[UIColor whiteColor];
    
    self.headImg = [[UIImageView alloc]init];
    [baseView addSubview:self.headImg];
    
    self.TitleLabel = [[UILabel alloc]init];
    [baseView addSubview:self.TitleLabel];
    
    self.lineImg = [[UIImageView alloc]init];
    [baseView addSubview:self.lineImg];
    
    UIImageView *img =[[UIImageView alloc]init];
    [baseView addSubview:img];
    [self.TitleLabel sizeToFit];
    
    [self.headImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(baseView.mas_centerY);
        make.left.equalTo(baseView.mas_left).offset(LABELLEFT);
        make.height.equalTo(@(24));
        make.width.equalTo(@(24));

    }];

    [self.TitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(baseView.mas_centerY);
        make.left.equalTo(self.headImg.mas_right).offset(24/2);
//        make.height.equalTo(@(LABELHEIGHT));
    }];
    
    [self.lineImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headImg.mas_left);
        make.right.equalTo(img.mas_right);
        make.height.equalTo(@(1));
        make.bottom.equalTo(baseView.mas_bottom);
    }];
    
    [img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(baseView.mas_right).offset(-32/2);
        make.centerY.equalTo(baseView.mas_centerY);
        make.width.equalTo(@(17/2));
        make.height.equalTo(@(30/2));
    }];
    
//    self.headImg.backgroundColor = [UIColor redColor];
    
    self.TitleLabel.backgroundColor = [UIColor clearColor];
    self.lineImg.backgroundColor = [UIColor clearColor];
    self.headImg.image = [UIImage imageNamed:@"列表图标_"];
    
    self.TitleLabel.font = [UIFont systemFontOfSize:30/2];
    self.TitleLabel.textColor = [UIColor colorWithRed:0x5b/255.0 green:0x5b/255.0 blue:0x5b/255.0 alpha:1];
    self.lineImg.backgroundColor = [UIColor colorWithRed:0xe6/255.0 green:0xe6/255.0 blue:0xe6/255.0 alpha:1];
    [img setImage:[UIImage imageNamed:@"详细_"]];
    return baseView;
}
@end
